using System;
using System.Collections.Generic;
using System.Text;

namespace Fuzzy
{
    /// <summary>
    /// A class representing the min-max fuzzy operation set.
    /// </summary>
    public sealed class MinMaxFuzzyOperation:FuzzyOperation
    {
        /// <summary>
        /// The intersection operation (T-norm), min(x,y).
        /// </summary>
        /// <param name="x">The first operand of the operation.</param>
        /// <param name="y">The second operand of the operation.</param>
        /// <returns>T(x,y) = min(x,y)</returns>
        public override double TNorm(double x, double y)
        {
            return Math.Min(x, y);
        }

        /// <summary>
        /// The union operation (S-norm), max(x,y).
        /// </summary>
        /// <param name="x">The first operand of the operation.</param>
        /// <param name="y">The second operand of the operation.</param>
        /// <returns>S(x,y) = max(x,y)</returns>
        public override double SNorm(double x, double y)
        {
            return Math.Max(x, y);
        }

        /// <summary>
        /// The complement operation, 1-x.
        /// </summary>
        /// <param name="x">The operand of the operation.</param>
        /// <returns>C(x) = 1-x</returns>
        public override double Complement(double x)
        {
            return 1 - x;
        }
    }
}
